package com.crl.utils
{
	/**
	 * 回调代理，用于在回调中添加额外的参数;
	 * @author crl
	 * 
	 */	
	public class Delegate
	{
		public function Delegate()
		{
		}
		
		public static function create(func:Function,...args):Function{
			return createWithArgs(func,args);
		}
		
		private static function createWithArgs(func:Function,args:Array):Function{
			var f:Function=function():void{
					var fun:Function=arguments.callee.func;
					var pars:Array=arguments.concat(args);
					
					fun.apply(null,pars);
					
			}
			f["func"]=func;
			return f;
		}

	}
}